import {
  getMenuList
} from '@/api/portal-user'
const state = {
  menulist: '',
  sysIndex: 0
}
const mutations = {
  SET_MENU_LIST: (state, menulist) => {
    state.menulist = menulist
  },
  CHANGE_SYS: (state, sysIndex) => {
    state.sysIndex = sysIndex
  }
}
const actions = {
  // user login
  getMenuList({
    commit
  }) {
    //   const { username, password } = userInfo
    const params = {}
    return new Promise((resolve, reject) => {
      getMenuList(params).then(response => {
        console.log(response.data.code)
        if (response.data.code === 0) {
          commit('SET_MENU_LIST', response.data.data)
        }
        resolve()
      }).catch(error => {
        reject(error)
      })
    })
  }
}
export default {
  state,
  mutations,
  actions
}
